package org.pinda.server;

import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Loggers {
	
	private static Logger authLogger;
	
	public static Logger auth() {
		if(authLogger == null) {
			authLogger = createLogger("AUTH", Level.INFO);
		}
		return authLogger;
	}
	
	public static Logger createLogger(String name, Level minLevel) {
		Logger logger = Logger.getLogger(name);
		logger.setUseParentHandlers(false);
		logger.setLevel(minLevel);
		ConsoleHandler consoleHandler = new ConsoleHandler();
		consoleHandler.setFormatter(new LoggerFormat());
		consoleHandler.setLevel(minLevel);
		logger.addHandler(consoleHandler);
		return logger;
	}

}
